<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>五行</title>
    <style>
        /* 三角形 */
        .triangle{
            width: 600px;
            height: 600px;
            margin: 100px auto;
            position: relative;
        }
        .borders{
            width: 0px;
            height: 0px;
            border-style: solid; 
            position: absolute;
        }
        .br1{
            border-width: 50px 50px 150px 50px;
            border-color: transparent transparent seagreen transparent;
            top: -30px;
            left: 270px;
        }
        .br2{
            border-width: 50px 50px 50px 150px;
            border-color:   transparent transparent transparent slateblue;
            transform: rotate(-20deg);
            /* 图片旋转 */
            left: 376px;
            bottom: 370px;
        }
         .br3{
            border-width: 150px 50px 50px 50px;
            border-color:  salmon transparent transparent transparent;
            transform: rotate(-33deg);
            left: 363px;
            bottom: 130px;
        }
        .br4{
            border-width: 150px 50px 50px 50px;
            border-color:brown transparent transparent  transparent;
            transform: rotate(33deg);
            left: 172px;
            bottom: 130px;
        }
        .br5{
            border-width: 50px 150px 50px 50px;
            border-color: transparent sienna transparent  transparent;
            transform: rotate(20deg);
            left: 60px;
            bottom: 370px;
        } 
        /* 输入框--圆圈 */
        .rod{
            display: block;
            width: 50px;
            height: 50px;
            border: 1px solid black;
            background-color: white ;
            border-radius: 50%;
            position: absolute;
            font-size: 24px;
            text-align: center;
            line-height: 50px;
        }

         
        .rod:hover{
            border: 2px royalblue solid;
        }
        .round1{
            left: 295px;
            top: -20px;
        }
        .round2{
            left: 75px;
            top: 125px;
        }
        .round3{
            right: 40px;
            top: 125px;
        }
        .round4{
            right: 130px;
            bottom: 145px;
        }
        .round5{
            left: 165px;
            bottom: 145px;
        }
        /* 按钮 */
        .btns{
            position: absolute;
            bottom: 60px;
            left: 230px;
        }
        .btn{
            width: 40px;
            height: 40px;
            cursor: pointer;
            display: inline-block;
            background-color: #56a5f1;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="triangle">
            <!-- 三角形 -->
            <div class="borders" v-for="(triangle,index) in triangles" :class="triangle"></div>
            <!-- 圆圈 -->
            <div v-for="(word,index) in words" :key="index"  :class="'round'+(index+1)" class="rod"
            @click="pickSlot(index)">
            {{txt[index]}}
            </div>
            <!-- 按钮 -->
            <div class="btns">
                <button v-for="(word,index) in words" :key="index" class="btn" @click="pickEl(index)">{{word}}</button>
             </div>
        </div>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        let vm=new Vue({
            el:'#app',
            data:{
                triangles:[
                'br1','br2','br3','br4','br5'
                ],
                words:[
                    '金','木','水','火','土'
                ],
                 activeEl:0,
                 txt:['','','','','']
            },
            methods: {
                pickEl(index){
                //   console.log('当前选择元素',this.words[index]);  
                    this.activeEl=index
                },
                pickSlot(index){
                    // console.log('插槽对应的元素',this.words[index]);
                    // console.log(index==this.activeEl)
                    if(index==this.activeEl){
                        this.txt.splice(index,1,this.words[index]);
                    }
                }
            },
        })
    </script>
</body>
</html>